package clinicaveterinaria;

import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JTextField;
import javax.swing.JLabel;
import java.awt.Font;
import java.awt.Color;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.UIManager;

public class CadCliente extends JFrame {

	private JPanel contentPane;
	private JTextField txtNome;
	private JTextField txtCPF;
	private JTextField txtTelefone;
	private JTextField txtEndereco;
	private JTextField txtEmail;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					CadCliente frame = new CadCliente();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public CadCliente() {
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 450, 428);
		contentPane = new JPanel();
		contentPane.setBackground(new Color(153, 204, 255));
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(null);
		
		txtNome = new JTextField();
		txtNome.setColumns(10);
		txtNome.setBounds(48, 87, 246, 20);
		contentPane.add(txtNome);
		
		JLabel label = new JLabel("Digite o nome do cliente:");
		label.setBounds(58, 62, 241, 14);
		contentPane.add(label);
		
		JLabel label_1 = new JLabel("CPF do cliente:");
		label_1.setBounds(58, 121, 224, 14);
		contentPane.add(label_1);
		
		txtCPF = new JTextField();
		txtCPF.setColumns(10);
		txtCPF.setBounds(48, 146, 210, 20);
		contentPane.add(txtCPF);
		
		JLabel label_2 = new JLabel("Telefone do cliente:");
		label_2.setBounds(58, 177, 200, 14);
		contentPane.add(label_2);
		
		txtTelefone = new JTextField();
		txtTelefone.setColumns(10);
		txtTelefone.setBounds(48, 202, 210, 20);
		contentPane.add(txtTelefone);
		
		JLabel label_3 = new JLabel("Endereco do cliente:");
		label_3.setBounds(58, 239, 200, 14);
		contentPane.add(label_3);
		
		txtEndereco = new JTextField();
		txtEndereco.setColumns(10);
		txtEndereco.setBounds(48, 264, 288, 20);
		contentPane.add(txtEndereco);
		
		JLabel label_4 = new JLabel("Email do cliente:");
		label_4.setBounds(58, 295, 241, 14);
		contentPane.add(label_4);
		
		txtEmail = new JTextField();
		txtEmail.setColumns(10);
		txtEmail.setBounds(48, 320, 210, 20);
		contentPane.add(txtEmail);
		
		JLabel label_5 = new JLabel("Cadastro de Cliente");
		label_5.setFont(new Font("Trajan Pro", Font.BOLD, 25));
		label_5.setBounds(81, 11, 302, 26);
		contentPane.add(label_5);
		
		JButton btnCancelar = new JButton("Cancelar");
		btnCancelar.setBackground(UIManager.getColor("Button.light"));
		btnCancelar.setBounds(121, 367, 77, 23);
		contentPane.add(btnCancelar);
		
		JButton btnEnviar = new JButton("Enviar");
		btnEnviar.setForeground(new Color(0, 0, 0));
		btnEnviar.setBackground(UIManager.getColor("Button.light"));
		btnEnviar.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				Clinica.clientes.add(
						new Pessoa(
								txtNome.getText(),
								txtCPF.getText(),
								txtTelefone.getText(),
								txtEndereco.getText(),
								txtEmail.getText()
								)
						);
			}
		});
		btnEnviar.setBounds(222, 367, 77, 23);
		contentPane.add(btnEnviar);
	}
}
